# -*-coding:utf-8-*-
# Created by ccp on 2018/4/27.

class StaticAndClassMethod(object):
    msg = "Hello beautiful gril!"

    def __init__(self, name='nuset', color='black'):
        print("Constructor is called with params: ")
        print("name:%s" % name)
        print("color:%s" % color)
        self.name = name
        self.color = color

    # 打印输出当前信息
    def show(self):
        print(self.msg)
        print("Here is %s in %s!" % (self.name, self.color))

    # 静态函数
    @staticmethod
    def printMsg():
        print(StaticAndClassMethod.msg)

    # 类函数
    @classmethod
    def createObj(cls, name, color):
        print("Object will be created:%s(%s,%s)" % (cls.__name__, name, color))
        return cls(name, color)


StaticAndClassMethod.printMsg()
inst = StaticAndClassMethod.createObj("ccp", "red")
print(inst.msg)
